package com.ruoyi.loan.controller;

import com.ruoyi.common.core.utils.AliyunOssUtil;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author 姜毅
 * @Version 1.0
 * @description: TODO
 * @date 2023/1/16 15:33
 */
@CrossOrigin
@RestController
@RequestMapping("upload")
public class UploadFileController {
    /**
     * 上传贷款凭证
     */
    @ApiOperation("上传贷款凭证")
    @PostMapping("/uploadFlie")
    public AjaxResult uploadFlie(@RequestParam("file") MultipartFile file)
    {
        AliyunOssUtil oss = AliyunOssUtil.OSS();
        String url = oss.upload(file);
        return AjaxResult.success("文件上传成功",url);
    }
}
